from django.contrib import admin

# Register your models here.
from bbs.models import Article, Category, Banner, Tag, Tui, Link


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id', 'category', 'title', 'tui', 'views', 'created_time')
    # 文章列表里想要显示的字段
    list_per_page = 50
    # 满足50页就自动分页
    ordering = ('created_time',)
    # 后台列表排序方式
    list_display_links = ('id', 'title')
    # 设置哪些字段可以进入编辑模式


@admin.register(Banner)
class BannerAdmin(admin.ModelAdmin):
    list_display = ('id', 'text_info', 'img', 'link_url', 'is_active')


@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'index')


@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')


@admin.register(Tui)
class TuiAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')


@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'link_url')
